package com.caocaog.market.finance.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.caocaog.market.modules.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @author liguang
 * @version 1.0.0
 * @Project jeecg-boot
 * @Package com.caocaog.market.finance.entity
 * @ClassName MkBillLine.java
 * @createTime 2021年12月03日 17:58:00
 * @Description 账务——账单行记录表
 */
@Data
@Accessors(chain = true)
@TableName("mk_bill_line")
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "账务模块账单行记录表", description = "账务模块账单行记录表")
@AllArgsConstructor
@NoArgsConstructor
public class MkBillLine extends BaseEntity {
    /**
     * 抽成人对应的单位id，主要是指分站id（关联mk_site_basic表中的id字段）；总部的抽成该字段存0（代表总部）
     */
    @ApiModelProperty(value = "抽成人单位id")
    private String rakeUserId;

    @Excel(name = "分站名称", width = 15)
    private transient String siteName;
    @Excel(name = "商家名称", width = 15)
    private transient String merchantName;
    @Excel(name = "门店名称", width = 40)
    private transient String shopName;

    @ApiModelProperty(value = "备注")
    private String mark;
    @Excel(name = "订单号", width = 50)
    @ApiModelProperty(value = "订单号，对应MkBillBase对象中的orderNo")
    private String orderNo;

    @ApiModelProperty(value = "账单id，对应MkBillBase对象中的id")
    private String billBaseId;

    @Excel(name = "实付金额", width = 15, type = 4, isStatistics = true)
    private transient String payAmount;

    /**
     * 提成比例（门店没有抽成比例，存：1 - 总部抽成比例 - 分站抽成比例）
     */
    @Excel(name = "佣金比例", width = 15, type = 4)
    @ApiModelProperty(value = "抽成比例")
    private String rakeRate;

    @Excel(name = "本单收益", width = 15, type = 4, isStatistics = true)
    @ApiModelProperty(value = "抽成金额")
    private String rakeAmount;

    @Excel(name = "审核状态", dicCode = "bill_withdraw_cash_status", width = 15)
    @ApiModelProperty(value = "提现状态，提现状态（1待提现（可提现）、2已提出提现申请待总部审核（审核中）、3提现申请审核通过待转账（待转账）、4提现申请被驳回（被驳回）、5已提现、6提现失败）")
    @Dict(dicCode = "bill_withdraw_cash_status")
    private Integer withdrawCashStatus;

    /**
     * （1系统、2分站、3门店）
     */
    @Excel(name = "提现类型", dicCode = "bill_line_type", width = 15)
    @ApiModelProperty(value = "抽成各方类型")
    @Dict(dicCode = "bill_line_type")
    private int type;

    @ApiModelProperty(value = "提现审核时间")
    private String withdrawApplyCheckTime;
    @ApiModelProperty(value = "提现成功时的支付宝订单号")
    private String aliOrderNo;
    @ApiModelProperty(value = "提现时的支付宝返回的回调信息")
    private String aliRelt;
    @ApiModelProperty(value = "当提现状态为“4提现申请被驳回”时填写的原因")
    private String withdrawRejectReason;


    @Excel(name = "结算时间", width = 40, databaseFormat = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @Excel(name = "申请提现时间", width = 40, databaseFormat = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "申请提现时间")
    private Date withdrawTime;


    @Excel(name = "结算时支付宝姓名", width = 15)
    @ApiModelProperty(value = "抽成人姓名")
    private String rakeAliname;
    @Excel(name = "结算时支付宝账号", width = 20)
    @ApiModelProperty(value = "抽成人支付宝账号")
    private String rakeAlipay;
    @Excel(name = "批量审核单号", width = 50)
    @ApiModelProperty("批量审核单号")
    private String auditNo;

    @ApiModelProperty("提现申请关联表id")
    private Integer billChangeId;

    // 以下字段为业务字段，在数据库表中是没有的
    // 多个状态
    private transient int[] withdrawCashStatuses;
    //分站id
    private transient String siteId;

    //商家id
    private transient String merchantId;
    //门店id
    private transient String shopId;
    // 余额
    private transient String totalBalance;
    // 可提现余额
    private transient String withdrawCashBalance;
    // 待提现钱数
    private transient String dtxBalance;
    // 已申请提现待总部审核钱数
    private transient String ysqdshBalance;
    // 审核通过待转账钱数
    private transient String shtgdzzBalance;
    // 驳回的钱数
    private transient String bhBalance;
    // 提现状态，字符串拼接
    private transient String statuses;
    // 总部的收益
    private transient String sysBalance;

}
